package com.ruoyi.web.controller.agoniappWeb;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.pojo.entity.VirtualStore;
import com.ruoyi.system.service.IAgoniVirtualStoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@RequestMapping("/pages/virtualStore")
public class VirtualStoreWebController {
    @Autowired
    private IAgoniVirtualStoreService agoniVirtualStoreService;

    @GetMapping("/listStores")
    public AjaxResult listStores() {
        return AjaxResult.success(agoniVirtualStoreService.listStores());
    }

    @PostMapping("/addStore")
    public AjaxResult addStore(@RequestBody VirtualStore virtualStore) {
        return AjaxResult.success(agoniVirtualStoreService.addStore(virtualStore));
    }

    /**
     * 根据设施ID获取商店列表
     * @param facilityId
     * @return
     */
    @GetMapping("/getStoresByFacilityId/{facilityId}")
    public AjaxResult getStoresByFacilityId(@PathVariable Long facilityId) {
        return AjaxResult.success(agoniVirtualStoreService.getStoresByFacilityId(facilityId));
    }

}
